#include "menucombobox.h"

MenuComboBox::MenuComboBox(QString text, QStringList options, int windowCenter, int y, QWidget *parent) :
    QWidget(parent)
{
    label = new QLabel(text, this);
    label->setProperty("menu", "true");
    label->show();

    comboBox = new QComboBox(this);
    comboBox->setProperty("menu", "true");
    comboBox->setEditable(false);
    comboBox->addItems(options);
    comboBox->show();

    layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
    layout->addWidget(label);
    layout->addWidget(comboBox);

    setLayout(layout);
    setGeometry(windowCenter - (sizeHint().width() / 2), y, sizeHint().width(), sizeHint().height());
}

QString MenuComboBox::getSelection() { return comboBox->currentText(); }

void MenuComboBox::setNewOptions(QStringList newOptions) {
    comboBox->clear();
    comboBox->addItems(newOptions);
}
